package com.weishaoying.thrift.learn.annotation;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.thrift.TException;


public class TestServiceImpl implements TestService {

    private final static Log logger = LogFactory.getLog(TestServiceImpl.class);

    @Override
    public TestResponse method1(TestRequest testRequest) throws TException {
        TestResponse testResponse = new TestResponse();
        testResponse.setUserid(testRequest.getUserid());
        testResponse.setMessage("HaHa" + testRequest.getMessage());
        testResponse.setSeqid(testRequest.getSeqid());

        System.out.println("--------" + testRequest.toString());
        System.out.println(testResponse.toString());
        try {
            logger.info("----Sleeping");
            Thread.sleep(1);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return testResponse;

    }

    @Override
    public long method2(int i) throws TException {
        System.out.println("-------- call method2() i = " + i);
        return i * 10;
    }

    @Override
    public String method3() throws TException {
        System.out.println("-------- call method3()");
        return "333";
    }

}
